public class Solution1736 {
    public String maximumTime(String time) {
        char c=time.charAt(3);
        if (c=='?'){
            c='5';
        }
        char d=time.charAt(4);
        if (d=='?'){
            d='9';
        }
        char a=time.charAt(0);
        char b=time.charAt(1);
        if (a=='?'){
            if (b=='?'){
                a='2';
                b='3';
            }else{
                a=b>'3'?'1':'2';
            }
        }else{
            if (b=='?'){
                b=a=='2'?'3':'9';
            }
        }
        return ""+a+b+":"+c+d;
    }

    public static void main(String[] args) {
        System.out.println(new Solution1736().maximumTime("2?:?0"));
    }
}
